Developer --> Technical Publications
PATHHardware Documentation > USB Devices > Mac OS USB DDK API Reference


USB Class Drivers

A USB device must have a USB class driver or drivers for every interface (function) the device supports to operate properly on the Macintosh computer. Macintosh USB class drivers are "ndrv" native code fragments and as such follow the guidelines specified for creating Macintosh native drivers in the Designing Macintosh PCI Cards and Drivers. USB class drivers provide a driver descriptor structure that the USB Manager uses to match with a device or interface.

The USB Manager matches drivers to device interfaces by initially examining the product ID and vendor ID fields in the device descriptor for the device. To ensure proper device and driver matching, additional information regarding the device is examined if none or more than one driver matches the product ID and vendor ID values for the device. Detailed information about how USB class driver and device matching is accomplished is in the Universal Serial Bus Common Class Specification which can be found at http://www.usb.org.

There are several classes of drivers defined by various USB specifications, and new classes are being proposed all the time. The Macintosh USB software includes HID class drivers for the HID interfaces in the USB keyboard and mouse. The keyboard and mouse drivers are loaded by a composite class driver, which is loaded by the hub driver when the keyboard and mouse are found on the USB.

A USB device includes an interface or interfaces, which are defined in descriptor data structures associated with the device. The interfaces are like sub devices within the device, each having a function specified by numerical class and sub class identifiers. The functions provide device capabilities to the host system. Interfaces also define how a function in a device is accessed by the host system. The functional features of the device are accessed by the USL when given an interface reference.

The Macintosh system software maintains a driver dispatch table for USB class drivers that defines among other things the driver initialization routine, driver gestalt, and the driver callback completion routine. For more information, see the driver descriptor structure defined in the USB.h file.


© 1998 Apple Computer, Inc. – (Last Updated 23 Nov 98)

Previous | Back Up One Level | Next |